import 'package:enterprise_v6_app/app/core/http/http.dart';
import 'package:enterprise_v6_app/app/core/utils/interface.dart';
import 'package:enterprise_v6_app/app/data/entities/application/check_layer_entity.dart';
import 'package:enterprise_v6_app/app/data/entities/application/get_dict_all_entity.dart';
import 'package:enterprise_v6_app/app/data/entities/application/get_new_dict_all_entity.dart';
import 'package:enterprise_v6_app/app/data/entities/application/get_point_risk_entity.dart';
import 'package:enterprise_v6_app/app/data/entities/application/get_risk_analysis_entity.dart';
import 'package:enterprise_v6_app/app/data/entities/application/role_personnel_entity.dart';
import 'package:enterprise_v6_app/app/data/entities/application/special_list/ticket_receipt_valid_date_entity.dart';
import 'package:enterprise_v6_app/app/data/entities/application/special_list/work_count_entity.dart';
import 'package:enterprise_v6_app/app/data/entities/application/special_list/work_history_entity.dart';
import 'package:enterprise_v6_app/app/data/entities/application/special_list/work_today_status_entity.dart';

abstract class SpecialListApis {
  /// 根据角色名称获取角色人员
  /// [roleName] 角色名称
  static HttpRequest<List<RolePersonnelEntity>> getRoleName(String roleName) {
    return HttpUtil().generateGetRequest<List<RolePersonnelEntity>>(
        Interface.getRoleUserList,
        queryParameters: {
          'roleName': roleName,
        });
  }

  /// 查询字典所有数据
  static HttpRequest<List<GetDictAllEntity>> getDictAll() {
    return HttpUtil().generateGetRequest<List<GetDictAllEntity>>(
      Interface.getDictAll,
    );
  }

  /// 根据字典列表id查询字典属性
  /// enableCache 开启了缓存,重新登录即可清除缓存
  static HttpRequest<List<GetDictAllEntity>> getDictionaryDataByTree(
      {String? id, String? dictionaryType}) {
    return HttpUtil().generateGetRequest<List<GetDictAllEntity>>(
        enableCache: true,
        Interface.getDictionaryDataByTree,
        queryParameters: {
          'id': id,
          'dictionaryType': dictionaryType,
        });
  }
  /// new根据字典列表id查询字典属性
  static HttpRequest<List<GetNewDictAllEntity>> getNewDictionaryDataByTree(
      {String? id, String? dictionaryType}) {
    return HttpUtil().generateGetRequest<List<GetNewDictAllEntity>>(
        Interface.getDictionaryDataByTree,
        queryParameters: {
          'id': id,
          'dictionaryType': dictionaryType,
        });
  }

  /// 查询气体分析计时
  static HttpRequest<TicketReceiptValidDateEntity>
      getListConfigByTicketReceiptId(String ticketReceiptId) {
    return HttpUtil().generateGetRequest<TicketReceiptValidDateEntity>(
        Interface.getTicketReceiptValidDate,
        queryParameters: {'ticketReceiptId': ticketReceiptId});
  }

  ///作业类型异常数量统计
  ///[isMyTask]是否是我的任务 0-否 1-是 默认否
  static HttpRequest<List<WorkHistoryEntity>> getWorkTypeException(
      int isMyTask) {
    return HttpUtil().generateGetRequest<List<WorkHistoryEntity>>(
        Interface.getWorkTypeException,
        queryParameters: {'isMyTask': isMyTask});
  }

  ///特殊作业历史概览
  ///[isMyTask]是否是我的任务 0-否 1-是 默认否
  static HttpRequest<Map<String, dynamic>> getSpecialWorkHistory(int isMyTask) {
    return HttpUtil().generateGetRequest<Map<String, dynamic>>(
        Interface.getSpecialWorkHistory,
        queryParameters: {'isMyTask': isMyTask});
  }

  ///任务板(作业状态数量统计)
  ///[isMyTask]是否是我的任务 0-否 1-是 默认否
  static HttpRequest<WorkCountEntity> getTaskBoard(int isMyTask) {
    return HttpUtil().generateGetRequest<WorkCountEntity>(
        Interface.getTaskBoard,
        queryParameters: {'isMyTask': isMyTask});
  }

  ///作业中数量及违章作业数量统计
  static HttpRequest<WorkCountEntity> getWorkCount() {
    return HttpUtil()
        .generateGetRequest<WorkCountEntity>(Interface.getWorkCount);
  }

  ///作业单位违章概况
  static HttpRequest<WorkTodayStatusEntity> getWorkViolation() {
    return HttpUtil()
        .generateGetRequest<WorkTodayStatusEntity>(Interface.getWorkViolation);
  }

  /// 查看图层列表
  /// [model] 模块编号：0 仓储；1 双重预防；2 特殊作业 3；重大危险源；4 教育培训；5 敏捷应急；6封闭化；7 其他
  static HttpRequest<List<CheckLayerEntity>> getLayerList({required int model}) {
    return HttpUtil().generateGetRequest(Interface.getLayerList,queryParameters: {
      'model': model,
    });
  }

  /// 根据图层id，获得对应的标绘主体
  /// [id] 标绘主体id
  static  HttpRequest<List<GetPointRiskEntity>> getLayerById({required String? id}) {
    return HttpUtil().generateGetRequest(Interface.getPlotMainByLayerId,queryParameters: {
      'id': id,
    });
  }

  /// 获取所有风险分析对象（一般危险源）（不分页）
  static HttpRequest<List<GetRiskAnalysisEntity>> getRiskAnalysisObject() {
    return HttpUtil().generateGetRequest(Interface.getRiskAnalysisBySource,queryParameters:{'type':1});
  }
}
